import axios from 'axios';

//创建axios实例
export const Service = axios.create({
  baseURL: 'http://localhost:8080',
  headers:{
    'Content-Type': "application/json;charset=UTF-8"
  },
  timeout:3000
});


export const loginAPI = (loginForm)=>{
  return Service.post('/login', loginForm)
}

export const signIn = (register)=>{
  return Service.post('/signIn', register)
}

export const travelRoute = ()=>{
  return Service.get('/vehicle/getTravelRoutes')
}

export const TypeList = ()=>{
  return Service.get('/vehicle/getTypeList')
}

export const addListener = (form) =>{
  return Service.post('/vehicle/add', form)
}

export const getListById = (id)=>{
  return Service.get('/vehicle/listById', { params: { id } })
}

export const getPageList = (payload)=>{
  return Service.get('/vehicle/pageList', { params: payload})
}

export const updateList = (form)=>{
  return Service.put('/vehicle/update', form)
}

export const deleteList = (id)=>{
  return Service.delete('/vehicle/delete', { params: { id } })
}

export const updatePassword = (payload)=>{
  return Service.put('/updatePassword', payload)
}

export const perfectInfo = (information)=>{
  return Service.put('/perfectInformation', information)
}

export const GetInvitationCode = ()=>{
  return Service.get('/getInvitationCode')
}

export const UpdateInvitationCode = (code)=>{
  return Service.put('/updateInvitationCode', code)
}

export const UploadAvatar = (url)=>{
  return Service.post('/upload', url)
}